import React from 'react'
import { useContext } from 'react'
//3. 导入 countContext
import { countContext } from '../A/A' 

export default function C() {
  //4. 使用 useContext
  let [count, setCount] = useContext(countContext);

  return (
    <div>
      <h3>CCC</h3>
      <p>爷爷组件中的数据: {count}</p>
      <button onClick={() => {
        setCount(count + 1);
      }}>新增</button>
    </div>
  )
}
